﻿package idv.cjcat.emitter.behaviors {
	use namespace engine;
	
	import flash.display.*;
	
	import idv.cjcat.emitter.*;
	
	/**
	 * Death behavior.
	 */
	public class DeathBehavior extends Behavior {
		
		private static var _singleton:DeathBehavior;
		public static function get singleton():DeathBehavior {
			if (_singleton == null) _singleton = new DeathBehavior();
			return _singleton;
		}
		
		override public function behave(pd:ParticleData):void {
			pd.life = 0;
		}
		
		
		//XML
		//------------------------------------------------------------------------------------------------
		
		override public function toXML():XML {
			var xml:XML = super.toXML();
			xml.@type = BehaviorType.DEATH;
			
			return xml;
		}
		
		//------------------------------------------------------------------------------------------------
		//end of XML
	}
}